package com.yzjs.localhost.controller.tDataLog;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import com.yzjs.common.enumeration.RequestMethod;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import com.yzjs.common.base.entity.PageInfo;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.yzjs.localhost.entity.tDataLog.TDataLogEntity;
import com.yzjs.localhost.service.tDataLog.TDataLogService;




/**
 * 日志信息数据
 *
 * @author yuqiumin
 * @email sunlightcs@gmail.com
 * @date 2021-09-04 17:24:32
 */
@Api(tags = "日志信息数据")
@RestController
@RequestMapping("tDataLog")
public class TDataLogController {
    @Autowired
    private TDataLogService tDataLogService;




    /**
     * 信息
     */
    @ApiOperation(value="信息" ,httpMethod =RequestMethod.GET )
    @RequestMapping("/info")
    public TDataLogEntity info( @RequestParam(required = true)   Integer id){
        TDataLogEntity  query = new TDataLogEntity();
        query.setId(id);
        TDataLogEntity tDataLog = tDataLogService.findOne(query);
        return  tDataLog ;
    }
    /**
    * 列表查询
    * @return
    */
    @ApiOperation(value="列表查询" ,httpMethod =RequestMethod.POST )
    @RequestMapping("/list")
    public List<TDataLogEntity> List( @RequestBody TDataLogEntity tDataLog) {

        List<TDataLogEntity> tDataLogs = tDataLogService.findList(tDataLog);
        return tDataLogs;
    }


    /**
     * 分页查询
     * @param tDataLog
     * @return
     */
    @ApiOperation(value="分页查询" ,httpMethod =RequestMethod.POST )
    @RequestMapping("/listPage")
    public PageInfo<TDataLogEntity> listPage(@RequestBody TDataLogEntity tDataLog) {
        List<TDataLogEntity> tDataLogs  = tDataLogService.findList(tDataLog);
        return new PageInfo<>(tDataLogs ,tDataLog);
    }


    /**
     * 保存
     */
    @ApiOperation(value="保存" ,httpMethod =RequestMethod.POST )
    @RequestMapping("/save")
    public TDataLogEntity save(@RequestBody TDataLogEntity tDataLog){
		tDataLogService.insert(tDataLog);
        return tDataLog;
    }

    /**
     * 修改
     */
    @ApiOperation(value="修改" ,httpMethod =RequestMethod.POST )
    @RequestMapping("/update")
    public TDataLogEntity update(@RequestBody TDataLogEntity tDataLog){
		tDataLogService.update(tDataLog);
        return tDataLog;
    }

    /**
     * 删除
     */
    @ApiOperation(value="删除" ,httpMethod =RequestMethod.DELETE )
    @RequestMapping("/delete")
    public TDataLogEntity  delete( @RequestParam(required = true)  Integer id){
        TDataLogEntity  delete  = new TDataLogEntity();
        delete.setId(id);
        tDataLogService.delete(delete);
        return delete;
    }

}
